String literals vs constants for Session[...] dictionary keys

Posted by FreshCode on Stack Overflow See other posts from Stack Overflow or by FreshCode
Published on 2010-04-06T19:32:38Z Indexed on 2010/04/06 23:03 UTC
Read the original article Hit count: 387

Session[Constant] vs Session["String Literal"] Performance

I'm retrieving user-specific data like ViewData["CartItems"] = Session["CartItems"]; with a string literal for keys on every request. Should I be using constants for this?

If yes, how should I go about implementing frequently used string literals and will it significantly affect performance on a high-traffic site?


Related question does not address ASP.NET MVC or Session.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about c#